package com.twu.biblioteca;

/**
 * Created by dmortime on 07/03/2014.
 */
public class MainMenuWithLoggedInCustomer implements IMenu {
    private OutputWriter outputWriter;
    private InputReader inputReader;
    private Library library;
    private Customer customer;

    public MainMenuWithLoggedInCustomer(OutputWriter outputWriter, InputReader inputReader, Library library, Customer customer) {
        this.outputWriter = outputWriter;
        this.inputReader = inputReader;
        this.library = library;
        this.customer = customer;
    }

    public void display() {
        outputWriter.writeLines(
                "Please select one of the following options:",
                "(L)ist available books",
                "(C)heck out a book",
                "(R)eturn a book",
                "(E)xit",
                "",
                "(Enter one of the characters shown in parentheses)"
        );
    }

    public IMenu nextMenu() {
        String input = inputReader.getInput();
        if(input.equals("l")) {
            return new ListAvailableBooksMenu(outputWriter, inputReader, library, customer);
        } else if (input.equals("r")) {
            return new ReturnBookMenu(outputWriter, inputReader, library, customer);
        } else if (input.equals("c")) {
            return new CheckOutBookMenu(outputWriter, inputReader, library, customer);
        } else return null;
    }
}